package com.rslai.base.tool.servertest.database.postgresql;

import javax.sql.DataSource;

import org.dbunit.AbstractDatabaseTester;
import org.dbunit.database.IDatabaseConnection;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

public class PostgresJdbcDataBaseTester extends AbstractDatabaseTester {
    private static final Logger logger = LoggerFactory.getLogger(PostgresJdbcDataBaseTester.class);
    private DataSource dataSource;

    public PostgresJdbcDataBaseTester(DataSource dataSource) {
        this.dataSource = dataSource;
    }

    public synchronized IDatabaseConnection getConnection() throws Exception {
        logger.debug("getConnection() - start");
        return new PostgresConnection(this.dataSource.getConnection(), getSchema());
    }
}
